<?php
declare (strict_types = 1);

namespace app\validate\api;

use think\Validate;

/**
 * 和平精英验证器
 * Class Index
 * @package app\index\validate
 */
class Dawn extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'record_id'    => 'require|number',
        'page'         => 'number',
        'limit'        => 'number',
        'openid'       => 'require',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'record_id.require'    => 'record_id不可为空',
        'record_id.number'     => 'record_id必须为数字',
        'openid.require'       => 'openid不可为空',
        'page.number'          => 'page必须为数字',
        'limit.number'         => 'limit必须为数字',
    ];


    protected $scene = [
        'detail'   =>  ['record_id'],
        'list'     =>  ['page','limit'],
        'collect'        =>  ['record_id','openid'],
        'like'           =>  ['record_id','openid'],
        'collect_list'   =>  ['openid','page','limit'],
    ];

}
